#pragma once

typedef void *Pointer;

struct tSList;
typedef struct tSList SList;

SList *slist_append(SList *list, Pointer data);
SList *slist_prepend(SList *list, Pointer data);
void slist_insert(SList *sibling, Pointer data);
SList *slist_remove(SList *list, Pointer data);
SList *slist_remove_all(SList *list, Pointer data);
Pointer slist_remove_next(SList *sibling);
void slist_free(SList *list);
unsigned slist_length(SList *list);
SList *slist_copy(SList *list);
SList *slist_reverse(SList *list);
SList *slist_nth(SList *list, int n);
SList *slist_concat(SList *list1, SList *list2);
void slist_foreach(SList *list, void (*log_to_file)(Pointer data, Pointer user_data), Pointer user_data);
void log_to_file(Pointer data, Pointer user_data);
SList *slist_last(SList *list);
SList *slist_find(SList *haystack, Pointer needle);
SList *slist_find_custom(SList *haystack, Pointer needle, int (*compare_func)(Pointer a, Pointer b));
int compare_func(Pointer a, Pointer b);
int slist_position(SList *list, SList *el);
